package edu.ynu.se.xiecheng.achitectureclass.controller;

import edu.ynu.se.xiecheng.achitectureclass.entity.CameraDataEntity;
import edu.ynu.se.xiecheng.achitectureclass.service.CameraDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/CameraData")
public class CameraDataController {

    @Autowired
    private CameraDataService cameraDataService;

    @PostMapping("/captureAndSave")
    public String captureAndSaveImage() {
        return cameraDataService.captureAndSaveImage();
    }

    @GetMapping("/setLastThreePhotos")
    public List<String> getLastThreePhotos() {
        // 调用服务层方法获取最后三张照片的路径
        return cameraDataService.getLastThreePhotos();
    }
}
